#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

name       = fslint
installdir = debian/$(name)
bindir     = $(installdir)/usr/bin
_datadir   = /usr/share
datadir    = $(installdir)$(_datadir)

build:
	dh_testdir
	# Could modify source here before install,
	# but doing so would not allow one to run dpkg-buildpackage
	# from a working source tree.
	# Instead source edits are done in install:

clean:
	dh_testdir
	dh_testroot
	$(MAKE) -C po clean
	dh_clean

install:
	dh_testdir
	dh_testroot
	dh_clean

	# Note dh_installdirs will create dirs listed in fslint.dirs
	# Note dh_install will install files listed in fslint.install
	install -Dpm 755 fslint-gui ${bindir}/fslint-gui
	perl -pi -e 's|^liblocation=.*|liblocation="${_datadir}/${name}" #deb edit|' ${bindir}/fslint-gui
	perl -pi -e 's|^locale_base=.*|locale_base=None #deb edit|' ${bindir}/fslint-gui

	install -dm 755 ${datadir}/${name}/${name}/{fstool,supprt}
	install -dm 755 ${datadir}/${name}/${name}/supprt/rmlint
	install -pm 644 fslint.glade fslint_icon.png ${datadir}/${name}
	install -dm 755 ${datadir}/pixmaps
	ln -s ../${name}/fslint_icon.png ${datadir}/pixmaps
	install -pm 755 fslint/find* fslint/fslint fslint/zipdir ${datadir}/${name}/fslint
	install -pm 755 fslint/fstool/* ${datadir}/${name}/fslint/fstool
	install -pm 755 fslint/supprt/get* ${datadir}/${name}/fslint/supprt
	install -pm 755 fslint/supprt/md5sum_approx ${datadir}/${name}/fslint/supprt
	install -pm 644 fslint/supprt/fslver ${datadir}/${name}/fslint/supprt
	install -pm 755 fslint/supprt/rmlint/* ${datadir}/${name}/fslint/supprt/rmlint
	$(MAKE) -C po DESTDIR=$(CURDIR)/$(installdir) install

        #Note dh_desktop doesn't install desktop files?
	install -Dpm 644 fslint.desktop ${datadir}/applications/fslint.desktop


# Build architecture-dependent files here.
binary-dep: build

# Build architecture-independent files here.
binary-indep: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installman
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep

binary-arch:

.PHONY: build clean binary-indep binary install
